<div class="special-check main">
  <bid-tabs
    query-fn="maintenance.MaintenanceInformation"
    query-bean="maintenance.queryData"
    query-param="bidId"
    query-type="bid"></bid-tabs>
  <div class="query-info shadowbox">
    <div class="container-header">
      维修保养
    </div>
    <form class="base-info pa-form-content" name="queryForm" novalidate>
      <div class="pa-form-control pa-form-control-inline">
        <label for="name">设备名称：</label>
        <input type="text" class="form-control-input"
          ng-model="maintenance.queryData.deviceName">
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label for="name">内部编号：</label>
        <input type="text" class="form-control-input"
          ng-model="maintenance.queryData.innerNo">
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label for="name">设备等级：</label>
        <select
          ng-model="maintenance.queryData.deviceLevel">
          <option value=""></option>
          <option value="1">一般设备</option>
          <option value="2">主要设备</option>
          <option value="4">特种设备</option>
        </select>
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label for="name">维保时间：</label>
        <input type="text" ng-datepicker name="startTime" required
          ng-model="maintenance.queryData.startTime">
        到
        <input type="text" ng-datepicker name="endTime" required
          ng-model="maintenance.queryData.endTime">
      </div>
    </form>
    <div class="btn-outer-right">
      <a class="pa-btn"
        ng-click="maintenance.search(queryForm)">
        <i class="fa fa-search"></i>
        <span class="ml5">查询</span>
      </a>
      <a class="pa-btn reset-btn"
        ng-click="maintenance.reset()" >
        <i class="fa fa-repeat"></i>
        <span class="ml5">重置</span>
      </a>      
    </div>
  </div>
  <!-- <div class="registration-code">
    <a class="pa-btn"
      ng-click="maintenance.newInformation()">
      新增维保信息
    </a>
  </div> -->
  <div class="pa-table-container shadowbox">
    <form class="base-info">
      <table class="pa-table">
        <thead>
          <tr>
            <th>所属标段</th>
            <th>设备等级</th>
            <th>设备名称</th>
            <th>内部编号</th>
            <th class="time-sequence">
              <div>维保时间</div>
              <div class="time-sequence-btn">
                <div class="time-sequence-box"
                  ng-click="maintenance.up('maintain_time','0')">
                  <i class="fa fa-caret-up"></i>
                </div>
                <div class="time-sequence-box"
                  ng-click="maintenance.up('maintain_time','1')">
                  <i class="fa fa-caret-down"></i>
                </div> 
              </div>
            </th>
            <th>维保内容</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="item in maintenance.maintenanceItemList">
            <td>{{item.deviceInfoBean.tender}}</td>
            <td>{{item.deviceInfoBean.deviceLevel == '1' ? '一般设备' : 
             item.deviceInfoBean.deviceLevel == '2' ? '主要设备' : 
             item.deviceInfoBean.deviceLevel == '4' ? '特种设备' : ''}}</td>
            <td>{{item.deviceInfoBean.deviceName}}</td>
            <td>{{item.deviceInfoBean.innerNo}}</td>
            <td>{{item.maintainTime}}</td>
            <td>{{item.maintainContent}}</td>
            <td>
              <div class="edit-item del"
                authorization-btn="api/devicemaintainrecord/queryMaintainRecordInfo"
                ng-click="maintenance.editInformation(item.id)">
                <i class="fa fa-pencil color"></i>
                <span>编辑</span>
              </div>
              <div class="edit-item del"
                authorization-btn="api/devicemaintainrecord/deleteMaintainRecord"
                ng-click="maintenance.deleteInformation(item.id)">
                <i class="fa fa-trash color"></i>
                <span>删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </table> 
    </form>

    <div class="total-num">
      共计<span class="total-num-colorful">{{maintenance.paginationData.total}}</span>条
    </div>
    <!-- 分页 -->
    <div class="pagination-outer">
      <uib-pagination
        total-items="maintenance.paginationData.total"
        ng-model="maintenance.paginationData.pageNum"
        items-per-page="maintenance.paginationData.pageSize"
        ng-change="pageChange()"
        class="pagination-sm"
        boundary-link-numbers="true"
        max-size="5"
        next-text="下一页"
        previous-text="上一页"></uib-pagination>
    </div>
  </div>
</div>

<!-- 新增维保信息 -->
<script type="text/ng-template" id="maintenanceInfo">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>新增维保信息</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <form name="addMaintenanceInfo" id="addMaintenanceInfo"
        role="form" novalidate>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>牌照：</div>
          <div class="right-value">
            <input type="text" name="license" required
              ng-model="addMaintenance.queryData.deviceInfoBean.license"/>
          </div>
          <span class="error-tip"
            ng-show="(addMaintenanceInfo.$submitted || addMaintenanceInfo.license.$dirty) && addMaintenanceInfo.license.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>维保时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="maintainTime" required
              ng-model="addMaintenance.queryData.maintainTime"/>
          </div>
          <span class="error-tip"
            ng-show="(addMaintenanceInfo.$submitted || addMaintenanceInfo.maintainTime.$dirty) && addMaintenanceInfo.maintainTime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>维保内容：</div>
          <div class="right-value">
            <textarea style="width:188px;border-radius: 4px;"
              cols="30" rows="10" name="maintainContent" required 
              ng-model="addMaintenance.queryData.maintainContent"></textarea>
          </div>
          <span class="error-tip"
            ng-show="(addMaintenanceInfo.$submitted || addMaintenanceInfo.maintainContent.$dirty) && addMaintenanceInfo.maintainContent.$error.required">
            必填
          </span>
        </div>
      </form>        
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="addMaintenance.submit(addMaintenanceInfo)">
        <i class="fa fa-save"></i>
        <span class="ml5">确定</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>
<!--编辑维保信息-->
<script type="text/ng-template" id="editmaintenanceInfo">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>编辑维保信息</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <form name="editForm" novalidate>
        <div desc="autofocus-input">
          <input type="text" autofocus="true"
            style="opacity: 0;width: 0; height: 0;" />
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>维保时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="maintainTime" required 
              ng-model="editInfo.maintainTime"/>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.maintainTime.$dirty) && editForm.maintainTime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>维保内容：</div>
          <div class="right-value">
            <textarea style="width:188px;border-radius: 4px;"
              cols="30" rows="10" name="maintainContent" required 
              ng-model="editInfo.maintainContent"></textarea>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.maintainContent.$dirty) && editForm.maintainContent.$error.required">
            必填
          </span>
        </div>
      </form>
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="this.submit(editForm)">
        <i class="fa fa-save"></i>
        <span class="ml5">保存</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>
